public class Compare {
    public int compare (String version1, String version2) {
        // write code here
        String[] arr1 = version1.split("\\.");
        String[] arr2 = version2.split("\\.");
        int index1 = 0, index2 = 0;
        while (index1 < arr1.length || index2 < arr2.length) {
            int num1 = index1 < arr1.length ? Integer.valueOf(arr1[index1]) : 0;
            int num2 = index2 < arr2.length ? Integer.valueOf(arr2[index2]) : 0;
            if (num1 < num2) {
                return -1;
            } else if (num1 > num2) {
                return 1;
            }
            index1++;
            index2++;
        }
        return 0;
    }

    public static void main(String[] args) {
        Compare compare = new Compare();
        System.out.println(compare.compare("1.1", "2.1"));
    }
}
